package sim.input;





import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;

/**
 * A class for statically dealing with input to the screen via the mouse or the
 * touchscreen (on android).
 * 
 * 
 */
public abstract class Mouse
{
	private static boolean pressed = false;
	
	private Mouse()
	{
	}

	public static boolean isTouched()
	{
		return Gdx.input.isTouched();

	}

	/**
	 * Returns the position of the mouse cursor or the last touched point on
	 * android in world coordinates.
	 * 
	 * @param camera
	 *            - The camera that is currently viewing the app.
	 * @return A Vector2 of the current mouse position or the last touched point
	 *         on android.
	 */
	public static Vector2 getPos(Camera camera)
	{
		Vector3 pos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
		camera.unproject(pos);

		return new Vector2(pos.x, pos.y);
	}
	
	public static boolean isPressed()
	{
		if (isTouched())
		{
			if (!pressed)
			{

				
				pressed = true;
				return true;

			}
		} else
		{
			pressed = false;

		}

		return false;
	}

}
